﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Models;
using System.Data;

public partial class USJ : AdminBase
{
    private DataTable dc = new DataTable();
    public static bool EditUser = false;
    protected void Page_Load(object sender, EventArgs e)
    {
       
        if (!Page.IsPostBack)
        {
                grdbind();
        }
            
    }


    public void grdbind()
    {
        using (Entities bll = new Entities())
        {

            var Bpl = from u in bll.L_Feedback.OrderByDescending(u => u.FID) select u;


            if (txtUtel.Text.Trim() != "")
            {

                var seach = txtUtel.Text.Trim();
                Bpl = Bpl.Where(p => p.FTel.Contains(seach)|| p.FQQ.Contains(seach) || p.FMail.Contains(seach));
            }

            //PagedDataSource pds = new PagedDataSource();
            //pds.DataSource= Bpl.ToList();
            //pds.AllowPaging = true;
            AspNetPager1.RecordCount = Bpl.Count(); //记录总数；
            //pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex;
            //pds.PageSize = AspNetPager1.PageSize;
            this.rptList.DataSource = Bpl.Skip((AspNetPager1.CurrentPageIndex-1) * AspNetPager1.PageSize).Take(AspNetPager1.PageSize).ToList();  //这里好像一定要Tolist();不然会有点错误；;
            this.rptList.DataBind();
        }
    }


    protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
    {   //当页面页数改变时，执行这个方法；
        AspNetPager1.CurrentPageIndex = e.NewPageIndex;
        grdbind();
    }

    protected void btnSearch_Click(object sender, EventArgs e)
    {
        grdbind();
    }

    public string getSH(string ppid,string Lock)
    {
        string resurt = "";
        if (ppid == "8888")
        {
            resurt = "公司直属";
        }
        else if (string.IsNullOrEmpty(ppid))
        {
            resurt = "无上级";
        }
        else
        {
            if (string.IsNullOrEmpty(Lock))
                resurt = "";
            else
                if (Lock == "0")
                resurt = "通过";
            else
                resurt = "不同意";


        }

                return resurt;



    }
    

}